import { ICondition } from '@dfeidao/atom-web/interfaces';
import service from '@dfeidao/atom-web/msg/service';

export default async function get_data(systemid: string, refsystemid: string, modelid: string, table_name: string, condition: ICondition) {
	const params = {
		condition: condition || {
			paging: {
				index: 1,
				size: 12
			},
			param: {},
			sort: {}
		},
		emptydataflag: 0,
		modelid,
		refsystemid,
		systemid
	};
	const data = await service<{ docDataStore: { [table_name: string]: { dataArray: unknown[] } } }>('dataservice.findbusidata', params);
	const docDataStore = data.docDataStore;
	const table_data = docDataStore[table_name];
	const dataArray = table_data.dataArray;
	return dataArray;
}
